var probe = require('../global');

var origin = window.location.protocol === 'http:' ? probeAPIOrigin : probeAPIOriginWithSSL;
probe.service('Case', function ($resource) {
	return $resource(origin + probeAPIPathName + 'case/:caseId', null, {
		create: {
			method: 'POST'
		},
		modify: {
			method: 'PUT',
			params: { caseId: '@caseId' }
		},
		get: {
			method: 'GET',
			params: { caseId: '@caseId' }
		},
		query: {
			method: 'GET',
			isArray: true
		}
	});
}).service('Project', function ($resource) {
	return $resource(origin + probeAPIPathName + 'project', null, {
		login: {
			method: 'POST',
			url: origin + probeAPIPathName + 'login'
		},
		logout: {
			method: 'GET',
			url: origin + probeAPIPathName + 'logout'
		}
	});
}).service('Task', function ($resource) {
	return $resource(origin + probeAPIPathName + 'task/:taskId', null, {
		list: {
			method: 'GET',
			params: { mask: 'schemas' },
			isArray: true
		},
		create: {
			method: 'POST'
		},
		modify: {
			method: 'PUT',
			params: { taskId: '@taskId' }
		},
		get: {
			method: 'GET',
			params: { taskId: '@taskId'}
		}
	});
}).service('Result', function ($resource) {
	return $resource(origin + probeAPIPathName + 'result/', null, {
		upload: {
			method: 'POST'
		}
	});
});
